package org.sc.xl.test;


import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

public class RedisUtils {


    private static String key = "Bearer-eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ7XCJiZWxvbmdPcmdDb2RlXCI6XCI5OTk5OTlcIixcImJlbG9uZ09yZ05hbWVcIjpcIuWchumAmumAn-mAkuaciemZkOWFrOWPuFwiLFwiYmVsb25nT3JnVHlwZVwiOlwiSEVBRFwiLFwibGFuZ1wiOlwiemhcIixcIm9yZ0NvZGVcIjpcIjk5OTk5OVwiLFwib3JnTmFtZVwiOlwi5ZyG6YCa6YCf6YCS5pyJ6ZmQ5YWs5Y-4XCIsXCJvcmdUeXBlXCI6XCJIRUFEXCIsXCJzeXN0ZW1Db2RlXCI6XCJCSUdfREFUQV9URFwiLFwic3lzdGVtU291cmNlXCI6XCJQT1JUQUxcIixcInVzZXJDb2RlXCI6XCIwMTk5MDcwOVwiLFwidXNlck5hbWVcIjpcIuiMg-Wwj-mygVwifSIsImp0aSI6IjkxOWEzMGJlLWM0YmUtNDViZC1hZTUxLTY2ZDNjYTk1ZDBiNCIsImlhdCI6MTY2MDUzOTA2NSwiZXhwIjoxNjYwNTQ2MjY1fQ.rONFx7P008IUjqnNopdIS8kpt_jJ1mjJwaCYS1E9j608FukZuRBKP2WP5Y2wI15MrkymzvWgOYi9s7YO-e0ogg";

    private static String ke1 = "Bearer-eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ7XCJiZWxvbmdPcmdDb2RlXCI6XCI5OTk5OTlcIixcImJlbG9uZ09yZ05hbWVcIjpcIuWchumAmumAn-mAkuaciemZkOWFrOWPuFwiLFwiYmVsb25nT3JnVHlwZVwiOlwiSEVBRFwiLFwibGFuZ1wiOlwiemhcIixcIm9yZ0NvZGVcIjpcIjk5OTk5OVwiLFwib3JnTmFtZVwiOlwi5ZyG6YCa6YCf6YCS5pyJ6ZmQ5YWs5Y-4XCIsXCJvcmdUeXBlXCI6XCJIRUFEXCIsXCJzeXN0ZW1Db2RlXCI6XCJCSUdfREFUQV9URFwiLFwic3lzdGVtU291cmNlXCI6XCJQT1JUQUxcIixcInVzZXJDb2RlXCI6XCIwMTk5MDcwOVwiLFwidXNlck5hbWVcIjpcIuiMg-Wwj-mygVwifSIsImp0aSI6IjkxOWEzMGJlLWM0YmUtNDViZC1hZTUxLTY2ZDNjYTk1ZDBiNCIsImlhdCI6MTY2MDU0NTcyNSwiZXhwIjoxNjYwNTUyOTI1fQ.GKfll0LhksOFgYZokvyKWy4rYfzBFYBbuPzi9N7KULpQtKqesj48sPByaUfLVNWTAqkKhfV7_wVs6wlrShVMow";

    public static void main(String[] args) throws Exception {
        Set<HostAndPort> nodes = new HashSet<>();
        nodes.add(new HostAndPort("10.130.36.232", 6379));
        nodes.add(new HostAndPort("10.130.36.244", 6384));

        JedisCluster cluster = new JedisCluster(nodes);
        System.err.println(new Date() + " -- " + cluster.ttl(key));
        System.err.println(cluster.ttl("jscAuth|" + key));
        System.err.println(cluster.get("jscAuth|" + key));
        System.err.println(cluster.get(ke1));
    }
}
